#pragma warning(disable:4267)
#pragma warning(disable:4996)
#pragma warning(disable:6031)
#pragma warning(disable:6011)

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

namespace P02_02 {
int main();

int main()
{
	int nCase, nFeets;
	scanf("%d", &nCase);
	for (int i = 0; i < nCase; i++) {
		scanf("%d", &nFeets);
		if (nFeets % 4 == 0)
			printf("%d %d", nFeets / 4, nFeets / 2);
		else if (nFeets % 2 == 0)
			printf("%d %d", nFeets / 4 + 1, nFeets / 2);
		else
			printf("0 0");
		printf("\n");
	}
	
	return 0;
}
}

int main_P02_02()
{
	return P02_02::main();
}
